﻿<!--#INCLUDE FILE="config.asp"-->
<%
prefix = request("letterPrefix")

	' Read text file
	Dim filename, strFileText
	filename = ""&prefix&"-reservation-detail-letter.txt"
	on error resume next
	Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile(server.MapPath("Letter/"&filename),1)
	strFileText = objFileToRead.ReadAll()
	objFileToRead.Close
	Set objFileToRead = Nothing

	'============================='
	'	Create PDF				  '
	'============================='
	Set Pdf = Server.CreateObject("Persits.Pdf")
	Set Doc = Pdf.CreateDocument

	Doc.Title = "Reservation Detail Letter"
	Doc.Creator = "Costabaja Admin"

	Set Page = Doc.Pages.Add

	Set Font = Doc.Fonts("Helvetica")

	Params = "x=0; y=650; width=612; alignment=center; size=14"

	Page.Canvas.DrawText ""&strFileText, Params, Font

	'============================='
	'	End create PDF				  '
	'============================='

	' save to download
	Doc.SaveHttp("filename=Costabaja-ReservationDetails.pdf")

%>